package com.ycy.temperature.view.base;

import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by MI on 2018/7/26.
 */

public abstract class BaseViewPageFragment extends Fragment {
    protected BaseViewPageFragment act;
    protected final String TAG = getClass().getSimpleName();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(getLayoutID(), container, false);
        act = this;
        initView();
        initData(view);
        initListener();
        return view;
    }

    @LayoutRes
    protected abstract int getLayoutID();

    protected abstract void initListener();

    protected abstract void initView();

    protected abstract void initData(View view);

    @SuppressWarnings("unchecked")
    protected <E> E f(int id) {
        return (E) getActivity().findViewById(id);
    }
}